import { Component } from '@angular/core';
import { IonicPage, NavController, LoadingController } from 'ionic-angular';

import { IndexedDBService } from '../../services/indexeddb.service'
/**
 * Generated class for the LoginPage page.
 *
 * See http://ionicframework.com/docs/components/#navigation for more info
 * on Ionic pages and navigation.
 */

@IonicPage()
@Component({
    selector: 'page-login',
    templateUrl: 'login.html',
})
export class LoginPage {

    userName: string;
    password: string;

    constructor(
        public navCtrl: NavController, 
        private loadCtrl: LoadingController, 
        private indexedDb: IndexedDBService
    ) {
        
        this.indexedDb.myId = "10000000";
        this.indexedDb.open();
    }

    login(): void {
        let loading = this.loadCtrl.create({
            content: "loading...",
            dismissOnPageChange: true,
            showBackdrop: false
        });
        loading.present();
        setTimeout(()=>{
            this.navCtrl.push('TabsPage');
        }, 1000);
    }

    ionViewDidLoad() {
        console.log('ionViewDidLoad LoginPage');
    }
    
}
